/*
 * Copyright 1999-2004 Alibaba.com All right reserved. This software is the confidential and proprietary information of
 * Alibaba.com ("Confidential Information"). You shall not disclose such Confidential Information and shall use it only
 * in accordance with the terms of the license agreement you entered into with Alibaba.com.
 */
package action.expr.ast;

import action.expr.ActionVisitor;
import action.expr.VisitableAction;

/**
 * action���ʽ
 * 
 * @author pf-miles 2011-6-17 03:01:49
 */
public class Action implements VisitableAction {

    private Assignments assignments;

    public void accept(ActionVisitor visitor, Object... params) {
        visitor.visitAction(this, params);
    }

    public String toString() {
        return this.assignments.toString();
    }

    public Assignments getAssignments() {
        return assignments;
    }

    public void setAssignments(Assignments assignments) {
        this.assignments = assignments;
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((assignments == null) ? 0 : assignments.hashCode());
        return result;
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;
        if (getClass() != obj.getClass())
            return false;
        Action other = (Action) obj;
        if (assignments == null) {
            if (other.assignments != null)
                return false;
        } else if (!assignments.equals(other.assignments))
            return false;
        return true;
    }
}
